﻿using System;
using System.Globalization;
using System.Threading;

namespace Infrastructure.NetExtensions
{
    public static class LocalDateTime
    {
        static LocalDateTime()
        {
        }

        public static void SetIsraelFormat()
        {
            CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();
            culture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
            culture.DateTimeFormat.LongTimePattern = "";
            Thread.CurrentThread.CurrentCulture = culture;
        }

        public static string IsraelFormat(this DateTime date)
        {
            return date.ToString("dd/MM/yyyy");
        }

        public static string TimeFormat(this DateTime date)
        {
            return date.ToString("HH:mm");
        }
    }
}
